#ifndef _MAT_3X3_H_
#define _MAT_3X3_H_

#include "vec2.h"

namespace math
{

class		Mat3x3
{
public:

				Mat3x3();
				Mat3x3(float	Rotation);
				Mat3x3(	float m11, float m12, float m13,
							float m21, float m22, float m23,
							float m31, float m32, float m33	) :
								_11(m11) , _12(m12),  _13(m13),
								_21(m21), _22(m22),  _23(m23), 
								_31(m31), _32(m32),  _33(m33)	
				{	 }
				Mat3x3(const Mat3x3& From) :
								_11(From._11) , _12(From._12),  _13(From._13),
								_21(From._21), _22(From._22),  _23(From._23), 
								_31(From._31), _32(From._32),  _33(From._33)	
				{	 }
				~Mat3x3();
	void		Identity();


	void		TransformVec2(const math::Vec2&	From, math::Vec2& To);
	
	// build matrix 
	void		BuildMatrix(float Rad, const math::Vec2& Offset);
	void		BuildTranslation(const math::Vec2& Offset);
	void		BuildRotation(float	Rad);
	void		BuildScale(const math::Vec2& Scale);
	
	// helper functions that implicitly use BuildMatrix functions
	void		Translate(const math::Vec2& Offset);
	void		Rotate(float	Rad);
	void		Scale(const math::Vec2& Scale);

	// fetch information
	math::Vec2	GetUp();
	math::Vec2	GetRight();
	math::Vec2	GetPos();

	static	void	Multiply(const Mat3x3& A, const Mat3x3& B, Mat3x3& Dest);

    union {
        struct {
            float        _11, _12, _13;
            float        _21, _22, _23;
            float        _31, _32, _33;
            float        _41, _42, _43;
        };
        float m[3][3];
    };
};

}	// namespace math

#endif // _MAT_3X3_H_